import { getComsMobx } from '../util/convert';

import { observable, action } from 'mobx';
import { fieldLinkageCfg , formulaCfg } from '../apis/req';

export class FieldLinkageCfg {

    @observable isFieldTrigger = '';

	@observable tips13= '';
    @observable isFormula = '';

    /**
     * 初始数据
     */
    @action riggerFieldLinkageCfg(para={}){
        para = Object.assign(para,{optype:'get'});
        fieldLinkageCfg(para).then((reVal)=>{
            if(reVal.success){
                this.isFieldTrigger = reVal.isFieldTrigger;
                this.tips13 = reVal.tips13;
            }
        });
    }

    /**
     * update isFieldTrigger
     */
    @action updateIsFieldTrigger(para={}){
        this.isFieldTrigger = para.isFieldTrigger;
        para = Object.assign(para,{optype:'save'});
        fieldLinkageCfg(para).then((reVal)=>{

        });
    }

    /**
     * 初始数据
     */
    @action riggerFormulaCfg(para={}){
        para = Object.assign(para,{optype:'get'});
        formulaCfg(para).then((reVal)=>{
            if(reVal.success){
                this.isFormula = reVal.isFormula;
            }
        });
    }

    /**
     * update isFieldTrigger
     */
    @action updateIsFormula(para={}){
        this.isFormula = para.isFormula;
        para = Object.assign(para,{optype:'save'});
        formulaCfg(para).then((reVal)=>{

        });
    }

}